<template>
    <div>
        <!--  头条精选 -->
        <div>
            <div class="class-list-container">
                <!-- 课程标题行 -->
                <div class="class-title-line">
                    <div class="class-title">
                        <img src="@/assets/images/king's hat.png" alt="">
                        <span>头条精选</span>

                    </div>
                    <div class="more-btn">
                        <a href="">更多</a>
                        <img src="@/assets/images/箭头.svg" alt="">
                    </div>
                </div>

                <!-- 课程列表 -->
                <div class=" class-list-container">
                     
                    <div class=" class-list-item" v-for="item in headlineList " :key="item.articleId">
                        <div class="img-container">
                            <img :src="item.coverImgUrl" alt="">
                        </div>
                        <div class="class-title">{{  item.title }} </div>
                    </div>

                </div>

            </div>
        </div>
    </div>
</template>

<script>
import {getHeadlineList}  from '@/api/request'
export default {
    name: 'HeadLine',
    data() {
        return {
            headlineList: []
        }
    },
    created(){
        getHeadlineList({}).then((result) => {
            this.headlineList = result.rows;
            console.log('getHeadlineList',this.headlineList);
        }).catch((err) => {
            console.log(err);
            
        });
    }
}
</script>

<style lang="less" scoped>
.class-list-container {
    width: 1160px;
    // height: 400px;
    background-color: white;
    margin: 0 auto;
    margin-top: 20px;
    border-radius: 20px;
    padding: 10px;


    .class-title-line {
        height: 50px;
        display: flex;
        justify-content: space-between;
        align-items: center;
        border-bottom: 2px solid #e8e8e8;
        padding: 0 12px 10px 0;
        margin-top: 20px;

        .class-title {

            >img:nth-child(1) {
                width: 40px;
                height: 40px;
                margin-right: 15px;
            }

            >span {
                font-weight: 600;
                font-size: 24px;
                line-height: 1.5;
            }

            >img:nth-child(3) {

                cursor: pointer;
                margin-left: 8px;
                width: 93px;
                height: 33.5px;
            }
        }

        .more-btn {
            display: flex;
            align-items: center;

            >a {
                color: #999;
                font-size: 16px;
                line-height: 34px;
            }

            >img {
                width: 16px;
            }
        }
    }

    .class-list-container {
        display: flex;
        width: 1140px;
        justify-content: space-between;
    }

    a {
        .class-list-item {
            margin-bottom: 10px;
            box-shadow: 0 4px 10px 0 rgba(0, 0, 0, .15);
            border-radius: 10px;
            color: #000;
            padding-bottom: 10px;

            >.img-container {
                margin-bottom: 10px;
                overflow: hidden;
                border-radius: 10px 10px 0 0;

                >img {
                    width: 215px;
                    height: 118px;
                    transition: all 0.3s;

                    &:hover {
                        transform: scale(1.1);
                    }
                }
            }

            >.class-title {
                padding-left: 10px;
                margin-bottom: 10px;
                font-size: 14px;
                width: 215px;
                /* 文字在一行显示，多余隐藏，用省略号表示 */
                white-space: nowrap;
                text-overflow: ellipsis;
                overflow: hidden;

                &:hover {
                    color: green;
                }
            }

            >.class-info {
                color: #b7bbc4;
                height: 22px;
                box-sizing: border-box;
                line-height: 1.5;
                padding-left: 10px;
                margin-bottom: 10px;
            }

            >.class-price {
                padding: 0 10px;
                margin-bottom: 10px;
                display: flex;
                justify-content: space-between;
                align-items: center;

                .free {
                    color: #00cf8c;
                    font-weight: 600;
                    font-size: 16px;
                }

                .price {
                    color: #ff4500;
                    font-weight: 500;
                    font-family: -apple-system, BlinkMacSystemFont, Segoe UI, PingFang SC, Hiragino Sans GB, Microsoft YaHei, Helvetica Neue, Helvetica, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol;
                    font-variant: tabular-nums;
                    line-height: 1.5;
                }

                .old-price {
                    color: #999;
                    text-decoration: line-through;
                    font-size: 12px;
                }

                .discount-info {
                    color: #fa8c16;
                    background: #fff7e6;
                    border-color: #ffd591;
                    border: 1px solid #d9d9d9;
                    padding: 0 7px;
                    font-size: 12px;
                    box-sizing: border-box;
                }
            }

        }
    }

    .class-list-item {
        margin-bottom: 10px;
        box-shadow: 0 4px 10px 0 rgba(0, 0, 0, .15);
        border-radius: 10px;
        color: #000;
        padding-bottom: 10px;

        >.img-container {
            margin-bottom: 10px;
            overflow: hidden;
            border-radius: 10px 10px 0 0;

            >img {
                width: 215px;
                height: 118px;
                transition: all 0.3s;

                &:hover {
                    transform: scale(1.1);
                }
            }
        }

        >.class-title {
            padding-left: 10px;
            margin-bottom: 10px;
            font-size: 14px;
            width: 215px;
            /* 文字在一行显示，多余隐藏，用省略号表示 */
            white-space: nowrap;
            text-overflow: ellipsis;
            overflow: hidden;

            &:hover {
                color: green;
            }
        }

        >.class-info {
            color: #b7bbc4;
            height: 22px;
            box-sizing: border-box;
            line-height: 1.5;
            padding-left: 10px;
            margin-bottom: 10px;
        }

        >.class-price {
            padding: 0 10px;
            margin-bottom: 10px;
            display: flex;
            justify-content: space-between;
            align-items: center;

            .free {
                color: #00cf8c;
                font-weight: 600;
                font-size: 16px;
            }

            .price {
                color: #ff4500;
                font-weight: 500;
                font-family: -apple-system, BlinkMacSystemFont, Segoe UI, PingFang SC, Hiragino Sans GB, Microsoft YaHei, Helvetica Neue, Helvetica, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol;
                font-variant: tabular-nums;
                line-height: 1.5;
            }

            .old-price {
                color: #999;
                text-decoration: line-through;
                font-size: 12px;
            }

            .discount-info {
                color: #fa8c16;
                background: #fff7e6;
                border-color: #ffd591;
                border: 1px solid #d9d9d9;
                padding: 0 7px;
                font-size: 12px;
                box-sizing: border-box;
            }
        }

    }
}

a {
    text-decoration: none;
}
</style>
